package com.my.code.identityhashmap;

public class TestIdentityHash {
    public static void main(String[] args) {
        HashBean bean = new HashBean();
        int i = System.identityHashCode(bean);//返回系统默认方法的hashcode而不是重写的hashcode
        System.out.println(i);
        System.out.println(bean.hashCode());

        System.out.println("System.identityHashCode(\"abc\") = " + System.identityHashCode("abc"));
        System.out.println("System.identityHashCode(new String(\"abc\")) = " + System.identityHashCode(new String("abc")));
        System.out.println("System.identityHashCode(new String(\"abc\")) = " + System.identityHashCode(new String("abc")));

    }
}
